<template>
  <footer class="footer">
    <span class="todo-count">总计：<strong>{{$store.getters.newList.length}}</strong></span>
    <ul class="filters">
      <li>
        <a :class='{"selected" : str == "全部"}'  href="javascript:;" @click="fn('全部')">全部</a>
      </li>
      <li>
        <a :class='{"selected" : str == "未完成"}' href="javascript:;" @click="fn('未完成')">未完成</a>
      </li>
      <li>
        <a :class='{"selected" : str == "已完成"}' href="javascript:;" @click="fn('已完成')">已完成</a>
      </li>
    </ul>
    <button class="clear-completed" @click="clearCompele">清除已完成</button>
  </footer>
</template>

<script>
export default {
  data() {
    return {
      str : '全部'
    }
  },
  methods : {
    fn(str) {
      this.str = str
      this.$store.commit('changeStr',str)
    },
    clearCompele() {
      this.$store.commit('clearCompele')
    }
  }

}
</script>